package com.platform.service.impl;

import com.platform.dao.IncomeCoinTaskDao;
import com.platform.entity.IncomeCoinTaskEntity;
import com.platform.service.IncomeCoinTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Service实现类
 *
 * @author LiangXiaoJie
 * @email 740596501@qq.com
 * @date 2019-01-03 16:57:58
 */
@Service("incomeCoinTaskService")
public class IncomeCoinTaskServiceImpl implements IncomeCoinTaskService {
    @Autowired
    private IncomeCoinTaskDao incomeCoinTaskDao;

    @Override
    public IncomeCoinTaskEntity queryObject(Integer id) {
        return incomeCoinTaskDao.queryObject(id);
    }

    @Override
    public List<IncomeCoinTaskEntity> queryList(Map<String, Object> map) {
//        Object date = map.get("date");
//        if (!StringUtils.isEmpty(date)) {
//            String time = DateUtils.format((Date) date, "yyyy-MM-dd");
//            map.put("date", time);
//        }

        return incomeCoinTaskDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return incomeCoinTaskDao.queryTotal(map);
    }

    @Override
    public int save(IncomeCoinTaskEntity sportsIntegralHistory) {
        return incomeCoinTaskDao.save(sportsIntegralHistory);
    }

    @Override
    public int update(IncomeCoinTaskEntity sportsIntegralHistory) {
        return incomeCoinTaskDao.update(sportsIntegralHistory);
    }

    @Override
    public int delete(Integer id) {
        return incomeCoinTaskDao.delete(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        return incomeCoinTaskDao.deleteBatch(ids);
    }

    @Override
    public boolean checkDynamic(Long userid, Integer ruleid, String date) {
        return incomeCoinTaskDao.checkDynamic(userid, ruleid, date) > 0;
    }

    @Override
    public Integer queryTotalByParam(Long userid, Integer ruleId) {
        return incomeCoinTaskDao.queryTotalByParam(userid, ruleId);
    }

    @Override
    public BigDecimal queryData(Map params) {
        return incomeCoinTaskDao.queryData(params);
    }
}
